<?php

//call library
require_once "../lib/nusoap/lib/nusoap.php";

//using soap_server to create server object
$server = new soap_server;

// create the function
function getallbook() {
    $conn = mysql_connect('localhost', 'root', 'root');
    mysql_select_db('books', $conn);

    $sql = "SELECT * FROM bookss";
    $q = mysql_query($sql);
    while ($r = mysql_fetch_array($q)) {
        $items[] = array('cd' => $r['cd'],
            'title' => $r['title'],
            'author' => $r['author'],
            'publisher' => $r['publisher']);
    }
    return $items;
}

//register a function that works on server
$server->register('getallbook');

// create HTTP listener
$server->service($HTTP_RAW_POST_DATA);

exit();
?>